package com.wind.easycode.common.base;

import com.alibaba.fastjson.annotation.JSONField;

public class BasePageDTO{
	
	private String code;
	

	private String msg;
	
	
	private String action;
	
	
	private String account;
	
	
	private Integer  pageSize=10;
	
	private Integer  pageNum=1;
	
	
	private Long total;
	
	//private UserDto currentUser;
	
	
	BasePageDTO(){}
	
	BasePageDTO(String code ,String msg){
		this.code=code;
		this.msg=msg;
		
	}
	public void setPaging(Paging paging){
		pageSize=paging.getPageSize();
		pageNum=paging.getPageNum();
		total=paging.getTotal();
		
	}
	public static Paging createPaging(BasePageDTO dto) {
		return new Paging(dto.getPageNum(),dto.getPageSize());	
	}
	
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Long getTotal() {
		return total;
	}

	public void setTotal(Long total) {
		this.total = total;
	}
	
	@JSONField(serialize=false)
	public Paging getPaging(){
		if(pageNum==null || pageSize== null){
			return null;
			
		}else{
			return new Paging(pageNum,pageSize);
		}
		
		
	}
	
}
